﻿// -----------------------------------------------------------------------
// <copyright file="IPushRequestService.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Push.Request
{
	using System;
	using System.Collections.Generic;

	/// <summary>
	/// Interface defining business operations to manage push requests.
	/// </summary>
	public interface IPushRequestService
	{
		/// <summary>
		/// Adds the specified push request to the persistent store.
		/// </summary>
		/// <param name="pushRequest">The push request.</param>
		void AddPushRequest(PushRequest pushRequest);

		/// <summary>
		/// Deletes completed push requests for the specified push application
		/// that are older than the provided date.
		/// </summary>
		/// <param name="pushApplicationId">The push application id.</param>
		/// <param name="toDate">To date.</param>
		/// <param name="deletedBy">The deleted by.</param>
		void DeleteCompletedPushRequests(
			string pushApplicationId, DateTime toDate, string deletedBy);

		/// <summary>
		/// Deletes a push request with the given push id.
		/// </summary>
		/// <param name="pushId">The push id.</param>
		void DeletePushRequest(string pushId);
		 
		/// <summary>
		/// Deletes push requests with the given push ids.
		/// </summary>
		/// <param name="pushIds">The push ids.</param>
		void DeletePushRequests(List<string> pushIds);
		 
		/// <summary>
		/// Deletes push requests for the specified push application that are
		/// older than the provided date.
		/// </summary>
		/// <param name="pushApplicationId">The push application id.</param>
		/// <param name="toDate">To date.</param>
		/// <param name="deletedBy">The deleted by.</param>
		void DeletePushRequests(
			string pushApplicationId, DateTime toDate, string deletedBy);
		 
		/// <summary>
		/// Finds all push requests.
		/// </summary>
		/// <returns></returns>
		IEnumerable<PushRequest> FindAll();

		/// <summary>
		/// Finds all push requests associated with a specified push application.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <returns></returns>
		IEnumerable<PushRequest> FindByAppId(String id);
		 
		/// <summary>
		/// Finds all push requests by the specified date range.
		/// </summary>
		/// <param name="fromDate">From date.</param>
		/// <param name="toDate">To date.</param>
		/// <param name="startIndex">The start index.</param>
		/// <param name="endIndex">The end index.</param>
		/// <returns></returns>
		IEnumerable<PushRequest> FindByDateRange(
			DateTime fromDate, DateTime toDate, int startIndex, int endIndex);
		 
		/// <summary>
		/// Finds a push request by the specified id.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <returns></returns>
		PushRequest FindById(string id);
		 
		/// <summary>
		/// Finds all push requests that are incomplete for a given push application.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <returns></returns>
		IEnumerable<PushRequest> FindIncomplete(string applicationId);
		 
		/// <summary>
		/// Gets size of all push requests by the specified date range.
		/// </summary>
		/// <param name="fromDate">From date.</param>
		/// <param name="toDate">To date.</param>
		/// <returns></returns>
		int GetSizeByDateRange(DateTime fromDate, DateTime toDate);
	}
}
